package com.xyq.fs.views;

import javafx.application.Application;

import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.ImageCursor;
import javafx.scene.Scene;

import javafx.scene.layout.VBox;
import javafx.scene.web.HTMLEditor;

import javafx.stage.Stage;
import javafx.stage.WindowEvent;

public class WindowsC extends Application {

	HTMLEditor htmlEditor = new HTMLEditor();
	static ImageCursor Mouse = new ImageCursor(WindowsHelp.getsb(), 0, 0);
	VBox root = new VBox();
	public void setText(String text) {

		htmlEditor.setHtmlText(text);
	}

	private String title = "";

	public void setTitle(String title) {

		this.title = title;
	}

	@Override
	public void start(Stage stage) {

		
		
		stage.setWidth(770);
		stage.setHeight(550);
		Scene scene = new Scene(root);
		stage.setScene(scene);
		root.getChildren().addAll(htmlEditor);
		stage.show();
		stage.getIcons().add(WindowsHelp.getImg());
		root.setPadding(new Insets(8, 8, 8, 8));
		root.setSpacing(5);
		root.setAlignment(Pos.BOTTOM_LEFT);
		htmlEditor.setHtmlText("内容加载中,请稍后...");
		stage.setTitle(title + "(内容预览)");
		htmlEditor.setPrefHeight(845);
		// 在scene中修改光标
		scene.setCursor(Mouse);
		/***
		 * 界面关闭事件
		 */
		stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
			@Override
			public void handle(WindowEvent event) {
				
				stage.close();
				title = null;
				htmlEditor = null;
				
			}
		});
	}

	public static void main(String[] args) {
		launch(args);
	}
}